package com.yuyou.fn.tradingservice.service;

import com.github.wens.framework.service.ISuperService;
import com.yuyou.fn.platform.entity.SysUser;
import com.yuyou.fn.tradingservice.entity.PersonLeaseMessage;
import com.yuyou.fn.tradingservice.entity.ServiceProductListing;
import com.yuyou.fn.tradingservice.vo.ListingDetailVo;

import java.util.List;

/**
 *
 * ServiceProductListing 表数据服务层接口
 *
 */
public interface IServiceProductListingService extends ISuperService<ServiceProductListing,Long> {

    Long addGoodToListing(SysUser user, Long productId,int quantity,Integer createOrAdd);

    List<ListingDetailVo> checkAndFind(Long buyerId);


    Long addLeaseToListing(Integer check,SysUser user, Long productId, List<PersonLeaseMessage> personLeaseMessageList,Integer createOrAdd);

    ServiceProductListing findByBuyIdAndProduct(Long buyId,Long productId);

    void updateListingQuantity(Long listingId, int quantity);

    /*way=0手动清除购物车，way=1创建订单后删除购物车*/
    void deleteListingByIds(List<Long> listingIds,Integer way);

    List<ServiceProductListing> findByBuyerId(Long buyerId);

    Long countByBuyerId(Long buyerId);


    void updateEffectiveness(Long productId,Integer effectiveness,String failureReason);

    void updateEffectivenessById(Long listingId,Integer effectiveness,String failureReason);

    /*deleteList 1:删除立即购买产生的购物车， 0不删除购物车*/
    void checkLeaseListingByIds(List<Long> listingIds,Integer deleteListing);

    void checkLeaseListing(List<ServiceProductListing> serviceProductListingList,Integer deleteListing);

}